Skip to content

Switch Event Indexing Guide to CedraFramework for Cedra CLI#81

Open
deranalabs wants to merge 4 commits intocedra-labs:mainfrom
deranalabs:event-indexing-cedraframework
Open

Switch Event Indexing Guide to CedraFramework for Cedra CLI#81
deranalabs wants to merge 4 commits intocedra-labs:mainfrom
deranalabs:event-indexing-cedraframework

Conversation

@deranalabs
Copy link
Copy Markdown

Cedra Builders Forge - Submission

Season 1

📋 Task Information


✅ Checklist

  • Commented "I'm taking this task" on the issue before starting
  • This PR contains ONE task only
  • All work is original (no copy-paste)
  • Code compiles without errors and all tests pass
  • Includes README, tests, and documentation
  • Will share PR in Cedra Builders Telegram

📝 What Was Built

This PR is a follow-up to the original Event Indexing Guide (#63).
It updates the example package to use CedraFramework so that builders can run the event-indexing tests directly with the Cedra CLI.

Key Features:

  • Move.toml updated to depend on CedraFramework (dev address cedra_guide = 0xc2)
  • cedra_guide::social_feed now imports cedra_framework::{event, account, timestamp}
  • Event indexing test test_end_to_end runs successfully via cedra move test

Technical Approach:

I reused the same event-indexing module and test, but switched the dependency from AptosFramework to CedraFramework and aligned the imports with Cedra’s modules. The dev-address pattern follows the official Cedra NFT example so that cedra move test works out of the box.

For Improvements:

  • What I improved: Aligned the Event Indexing example with CedraFramework and Cedra CLI.
  • Why: So builders can run and extend the guide using the native Cedra toolchain, without relying on Aptos CLI.
  • Before/After: Before, the guide compiled and tested only with AptosFramework + Aptos CLI; after this PR, it also compiles and tests with CedraFramework + Cedra CLI.

🧪 Testing

Setup:

# From the docs repository root
cd docs/guides/event-indexing

# Run Move unit tests with Cedra CLI
cedra move test

How to Test:

  1. Install the Cedra CLI.

  2. From docs/guides/event-indexing, run: cedra move test

  3. Confirm that the CedraEventGuide package builds and all tests pass.

Expected Results: The command should compile CedraFramework, build the CedraEventGuide package, and run: 0xc2::social_feed::test_end_to_end → PASS

Output similar to:

Plaintext

[ PASS    ] 0xc2::social_feed::test_end_to_end
Test result: OK. Total tests: 1; passed: 1; failed: 0
{
  "Result": "Success"
}

📚 Documentation

  • README with setup instructions (from original Event Indexing Guide)
  • Code comments on complex logic
  • Working usage examples (Move + event indexing pattern)
  • API/function behavior described in the guide

🎯 Quality Check

I confirm my submission:

  • Handles edge cases and errors properly (user must register before posting)
  • Follows Move conventions and best practices
  • Is gas efficient and reusable (events instead of stored vectors)
  • Has clear structure and helpful error messages/asserts
  • Does NOT contain plagiarism, malicious code, or spam

📸 Demo (Optional)

cd docs/guides/event-indexing
cedra move test
# [ PASS    ] 0xc2::social_feed::test_end_to_end

I have read and agree to follow all Cedra Builders Forge rules.

deranalabs and others added 4 commits November 21, 2025 00:25
This document outlines the Event Indexing pattern for building gas-efficient social feeds on Cedra, addressing state bloat and gas costs, and providing a code walkthrough for implementing the solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant